package com.wc.fortnight_blue_bridge.Q241201.高能粒子;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/12/2 15:46
 * @description
 * https://www.lanqiao.cn/problems/20050/learning/?contest_id=225
 */
public class Main {
    /**
     * 找两端点，因为最小值和最大值, 都在最两个边上
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010, M = 5 * N;
    static int[] a = new int[N], b = new int[N];
    static long[] c = new long[M], d = new long[M];
    static int n, m;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        m = sc.nextInt();
        for (int i = 1; i <= m; i++) c[i] = sc.nextInt();
        int mmid = 1, mnid = 1;
        for (int i = 1; i <= m; i++) {
            if (c[i] > c[mmid]) mmid = i;
            if (c[i] < c[mnid]) mnid = i;
        }
        for (int i = 1; i <= n; i++) d[i] = a[i] * c[mmid] + b[i];
        Arrays.sort(d, 1, n + 1);
        long mid1 = d[(n + 1) / 2];
        for (int i = 1; i <= n; i++) d[i] = a[i] * c[mnid] + b[i];
        Arrays.sort(d, 1, n + 1);
        long mid2 = d[(n + 1) / 2];
        if (mid1 > mid2) out.println(mmid + " " + mid1);
        else out.println(mnid + " " + mid2);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

